from selenium.webdriver.common.by import By
from Zk.Zk3.Page.Page import Page
import time
class Page2(Page):
    # 搜索梦之蓝
    sousuo_loc=(By.ID,'wd')
    def sousuo(self):
        self.send_keys(self.sousuo_loc,'梦之蓝')
    # 点击搜索按钮
    search_loc=(By.CLASS_NAME,'search-btn')
    def search(self):
        self.click(self.search_loc)
    # 点击商品详情
    shangpin_loc=(By.XPATH,'//img[@src="https://img07.jiuxian.com/2023/0224/6d8be8c068b24cf68973fdc409914ba14.jpg"]')
    def shangpin(self):
        self.click(self.shangpin_loc)
    # 加入购物车
    gouwuche_lou=(By.ID,'addToCartForDetail')
    def gouwuche(self):
        self.click(self.gouwuche_lou)
    # 查看购物车
    chakan_loc=(By.XPATH,'/html/body/div[2]/div/div[2]/ul/li[3]/a')
    def chakan(self):
        self.click(self.chakan_loc)
    # 去结算
    jiesuan_loc=(By.XPATH,'//*[@id="cart_container"]/div[3]/div[3]/a[1]')
    def jiesuan(self):
        self.click(self.jiesuan_loc)








    def jiuxian_02(self):
        self.test_jiuxian_login()
        self.sousuo()
        self.search()
        self.shangpin()
        self.qiehuan()
        # 强制等待
        time.sleep(3)
        self.gouwuche()
        self.chakan()
        # 隐式等待
        self.implicitly_wait(10)
        self.qiehuan()
        self.jiesuan()
        time.sleep(5)

